using SS;
using System;
using System.Data;
using System.Data.SqlClient;
namespace TVSGPP.core
{
	internal class billVAT
	{
		public int action(string ID, DateTime DateCreate, string billID, string CusName, string ComName, string CusAddress, string CusAccountBank, string Cuspayment, string CusTax, int Type)
		{
			int result;
			try
			{
				SqlConnection sqlConnection = new SqlConnection(Program.strConnectionString);
				sqlConnection.Open();
				SqlCommand sqlCommand = new SqlCommand("sp_ActionOnTabBillVAT", sqlConnection);
				sqlCommand.CommandType = CommandType.StoredProcedure;
				sqlCommand.Parameters.Add("ID", SqlDbType.VarChar, 50);
				sqlCommand.Parameters.Add("DateCreate", SqlDbType.DateTime);
				sqlCommand.Parameters.Add("billID", SqlDbType.NVarChar, 50);
				sqlCommand.Parameters.Add("CusName", SqlDbType.NVarChar, 500);
				sqlCommand.Parameters.Add("ComName", SqlDbType.NVarChar, 500);
				sqlCommand.Parameters.Add("CusAddress", SqlDbType.NVarChar, 500);
				sqlCommand.Parameters.Add("CusAccountBank", SqlDbType.NVarChar, 500);
				sqlCommand.Parameters.Add("Cuspayment", SqlDbType.NVarChar, 500);
				sqlCommand.Parameters.Add("CusTax", SqlDbType.NVarChar, 500);
				sqlCommand.Parameters.Add("Type", SqlDbType.SmallInt);
				sqlCommand.Parameters["ID"].Value = ID;
				sqlCommand.Parameters["DateCreate"].Value = DateCreate;
				sqlCommand.Parameters["billID"].Value = billID;
				sqlCommand.Parameters["CusName"].Value = CusName;
				sqlCommand.Parameters["ComName"].Value = ComName;
				sqlCommand.Parameters["CusAddress"].Value = CusAddress;
				sqlCommand.Parameters["CusAccountBank"].Value = CusAccountBank;
				sqlCommand.Parameters["Cuspayment"].Value = Cuspayment;
				sqlCommand.Parameters["CusTax"].Value = CusTax;
				sqlCommand.Parameters["Type"].Value = Type;
				sqlCommand.ExecuteNonQuery();
				sqlConnection.Close();
				sqlConnection.Dispose();
				result = 0;
			}
			catch
			{
				result = 1;
			}
			return result;
		}
		public void delBillVAT(string ID)
		{
			try
			{
				SqlConnection sqlConnection = new SqlConnection(Program.strConnectionString);
				sqlConnection.Open();
				SqlCommand sqlCommand = sqlConnection.CreateCommand();
				sqlCommand.CommandText = "DELETE TabBillVAT WHERE [ID] = '" + ID + "'";
				sqlCommand.ExecuteNonQuery();
				sqlConnection.Close();
				sqlConnection.Dispose();
			}
			catch
			{
			}
		}
	}
}
